package com.example.zlpermissionservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.zlpermissionservice.entity.UserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author zhenliu（孙凌岳）
 * @Description AI生成
 * @Date 2025/6/17 16:21
 * @Version 1.0
 */
@Mapper
public interface UserRoleMapper extends BaseMapper<UserRole> {
    /**
     * 根据角色id获取已绑定的用户id列表
     * @param roleId
     * @return
     */
    @Select("SELECT user_id FROM sys_user_role WHERE role_id = #{roleId} AND data_state = '0'")
    List<Long> findUserIdsByRoleId(@Param("roleId") Long roleId);
}